﻿///改变hello位置小游戏
namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.CursorVisible = true;
            int x = 0;
            int y = 0;
            int WindowHeight = 60;
            int WindowWidth = 20;
            Console.SetWindowSize(WindowHeight, WindowWidth);
            
            while (true)
            {
                char charactor = Console.ReadKey().KeyChar;
                Console.Clear();
                
                Console.SetCursorPosition(x, y);
                Console.WriteLine("  ");
                if (charactor == 'p')
                    break;
                    switch (charactor)
                {
                    case 'A':
                    case 'a':
                        x -= 1;
                        if (x < 0)
                            x = 0;
                        break;
                    case 'W':
                    case 'w':
                        y -= 1;
                        if (y < 0)
                            y = 0;
                        break;

                    case 'S':
                    case 's':
                        y += 1;
                        if (y < 0)
                            y = 0;
                        break;
                    case 'D':
                    case 'd':
                        if (x < 0)
                            x = 0;
                        x += 1;
                        break;
                    default:
                        break;
                }
                Console.SetCursorPosition(x, y);
                Console.WriteLine("Hello");


            }
        }
    }
}






